﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DanhmucThietbi
{
    public partial class frmSubThietBi : Form
    {
        CtrThietBi Ctr = new CtrThietBi();
        public ThietBiInfo ObjSubThietBi = new ThietBiInfo();

        public frmSubThietBi()
        {
            InitializeComponent();
            this.gridControl1.DataSource = Ctr.GetTB();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnCapnhat_Click(object sender, EventArgs e)
        {
            ObjSubThietBi.MA_TB = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MA_TB").ToString();
            ObjSubThietBi.TEN_TB = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TEN_TB").ToString();
            ObjSubThietBi.MA_PLOAI = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MA_PLOAI").ToString();
            ObjSubThietBi.MA_NHACC = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MA_NHACC").ToString();
            ObjSubThietBi.THONGTIN_TB = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "THONGTIN_TB").ToString();
            ObjSubThietBi.NGAY_SX = (DateTime)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_SX");
            ObjSubThietBi.NGAY_MUA = (DateTime)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_MUA");
            ObjSubThietBi.NGAY_SDUNG = (DateTime)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_SDUNG");
            ObjSubThietBi.NGUYEN_GIA = (int)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGUYEN_GIA");
            ObjSubThietBi.THOIGIAN_BHANH = (int)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "THOIGIAN_BHANH");
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
